package SpikingNeuron;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Scanner;

public class ReadFile {

	public static ArrayList<Double> ReadTargetFromFile(String path){
		ArrayList<Double> targetList = new ArrayList<Double>();
		try
		{

			Scanner fileScan = new Scanner (new File(path));
			while (fileScan.hasNext())
			{
				targetList.add(Double.parseDouble(fileScan.next()));
			}
		}
		catch(FileNotFoundException fe)
		{
			System.out.println("FileNotFoundException : " + fe);
		}
		catch(InputMismatchException ime)
		{
			ime.printStackTrace();
		}

		return targetList;
	}


	public static void main(String[] args)  {
		ArrayList<Double> test = ReadTargetFromFile("izzy-train1.dat");
		
		for (int i = 0; i < test.size(); i++) {
			System.out.println(test.get(i) + " ");
		}

	}
}